package com.apes.fico.masterdata.gl.model;

import com.apes.framework.jpa.DefaultPersistListener;
import com.apes.framework.jpa.Model;
import com.apes.framework.jpa.comment.Comment;
import com.apes.framework.jpa.generator.ApesGenerator;
import lombok.Getter;
import lombok.Setter;
import org.hibernate.annotations.DynamicInsert;
import org.hibernate.annotations.DynamicUpdate;
import org.hibernate.annotations.SelectBeforeUpdate;

import javax.persistence.*;

/**
 * @program: apestech
 * @description: 科目类型
 * @author: Chengxm
 * @create: 2019-01-04 16:06
 **/
@Getter
@Setter
@SelectBeforeUpdate
@DynamicInsert
@DynamicUpdate
@Entity
@EntityListeners(DefaultPersistListener.class)
@Table(name = AccountingChartType.CONST_TABLE_NAME)
public class AccountingChartType extends Model {

    public final static String CONST_TABLE_NAME="mas_acc_chart_type";

    @Id
    @Column(name = "id", length = 8)
    @ApesGenerator(code = CONST_TABLE_NAME, name = "科目类别")
    @Comment("科目类别")
    private String id;

    @Comment("科目类别名称")
    @Column(name = "name", nullable = false, length = 64)
    private String name;

    @ManyToOne(fetch = FetchType.LAZY)
    @JoinColumn(name = "acc_group_id", referencedColumnName = "id", nullable = false)
    @Comment("科目组编码")
    private AccountingGroup accountingGroup;

}
